﻿namespace NTrace
{
  using System;
  using ICSharpCode.NRefactory.PrettyPrinter;

  public class VBNetLanguage : TargetLanguage
  {
    public override IOutputAstVisitor CreatePrinter()
    {
      return new VBNetOutputVisitor();
    }

    public override OriginalSourceWrapper CreateSourceWrapper(String fileName, System.IO.TextWriter writer)
    {
      return new VBNetSourceWrapper(fileName, writer);
    }

    private class VBNetSourceWrapper : OriginalSourceWrapper
    {
      private System.IO.TextWriter writer;

      public VBNetSourceWrapper(String fileName, System.IO.TextWriter writer)
        : base(fileName, writer)
      {
        this.writer = writer;
        this.writer.WriteLine("#ExternalSource \"{0}\" 1", fileName);
      }

      public override void Dispose()
      {
        this.writer.WriteLine("#End ExternalSource");
      }
    }
  }
}
